<?php
session_start();

$cid = $_GET['cid'];
$num = $_GET['number'];
$text = $_GET['text'];

include 'dbconnect.php';

  // Check connection
if (mysqli_connect_errno())
  {
  //echo "alert'Failed to connect to MySQL: ' . mysqli_connect_error()";
  }
$number = $_SESSION['number'];
if ($number[0] == "+")
	$number[0] = "_";
$millitime = round(microtime(true) * 1000);
$sql="INSERT `messages$number` VALUES (null, '$num', '$text', 0, 2, '$millitime', '$cid');";

     if (!mysqli_query($con,$sql))
     {
          echo('Error: ' . mysqli_error($con));
     } 
	 echo "Message sent!";
  
mysqli_close($con);
?>
